package com.zkane.repository;

import com.zkane.domain.Employee;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author 594781919@qq.com
 * @date 2018/8/12
 */
@Repository
public interface EmpRepository extends MongoRepository<Employee, Long> {
    Employee findByName(String name);

    /**
     * 查询年龄大于age的数据
     *
     * @param age 年龄
     * @return
     */
    List<Employee> findByAgeGreaterThan(int age);

    @Query("{'address.city' : ?0}")
    List<Employee> findByCity(String city);
}
